import { getCptt } from '@/api/cpttApis'
// import { Message } from 'element-ui'
export default {
  namespaced: true,
  state:{
    cptts_noover:[],
    cptts_nogoing:[],
    isAction:false,
  },
  getters:{
    isAction:state => state.isAction,
    NO_OVER:state => state.cptts_noover,
    NO_GOING:state => state.cptts_nogoing,
  },
  mutations:{
    CHANGE_IS_ACTION:(state,tag) => { state.isAction = tag },
    SET_CPTT_NO_OVER:(state,cptts) =>{ state.cptts_noover = cptts},
    SET_CPTT_NO_GOING:(state,cptts) =>{ state.cptts_nogoing = cptts},
  },
  actions:{
    getCptt:async ({commit,dispatch},show)=>{
      await commit('CHANGE_IS_ACTION',true)
      await dispatch('GET_CPTT_NO_OVER')
      await dispatch('GET_CPTT_NO_GOING')
      await commit('CHANGE_IS_ACTION',false)
    },
    GET_CPTT_NO_OVER:async ({commit})=>{
      const { cptts } = await getCptt({state:2}).catch(()=>{})
      commit('SET_CPTT_NO_OVER',cptts)
    },
    GET_CPTT_NO_GOING:async ({commit})=>{
      const { cptts } = await getCptt({state:3}).catch(()=>{})
      commit('SET_CPTT_NO_GOING',cptts)
    },
    

  }
}